<!DOCTYPE html>
<html>
<head>
<?php $this->load->view('head'); ?>
</head>
<body>
<?php $this->load->view('header'); ?>
<div class="container-fluid main">
	<div class="row">
<?php $this->load->view('left'); ?>
		<div class="main-content col-md-10">
<?php $this->load->view('crumbs'); ?>
			<div class="panel panel-default panel-my">
				<div class="panel-heading">修改广告位</div>
				<div class="panel-body">
					<form class="form-horizontal J-ajax-form" action="<?php echo site_url('admin/advert/cate_edit'); ?>" method="post" accept-charset="utf-8" role="form">
                        <input type="hidden" name="id" value="<?php echo $advert_cate['id']; ?>">
                        <div class="form-group">
                            <label for="name" class="col-md-2 control-label">
                                广告位名称
                            </label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" id="name" name="name" value="<?php echo $advert_cate['name']; ?>">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="ckey" class="col-md-2 control-label">
                                广告位标识符
                            </label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" id="ckey" name="ckey" value="<?php echo $advert_cate['ckey']; ?>">
								<span class="help-block">只允许字母/数字/下划线/破折号</span>
                            </div>
                        </div>
						<div class="form-group">
                            <label for="descrip" class="col-md-2 control-label">
                                详细描述
                            </label>
                            <div class="col-md-10">
                                <textarea class="form-control" id="descrip" rows="3" name="descrip"><?php echo $advert_cate['descrip']; ?></textarea>
                            </div>
                        </div>
						<div class="form-group">
                            <label class="col-md-2 control-label">
                                显示方式
                            </label>
                            <div class="col-md-10">
                                <div class="radio">
                                    <label>
                                        <input type="radio" value="rand" name="config[display]"<?php echo Utility::if_check($advert_cate['config']['display'] == 'rand'); ?>>
                                        随机选一
                                    </label>
                                </div>
                                <div class="radio">
                                    <label>
                                        <input type="radio" value="all" name="config[display]"<?php echo Utility::if_check($advert_cate['config']['display'] == 'all'); ?>>
                                        显示全部
                                    </label>
                                </div>
								 <div class="radio">
                                    <label>
                                        <input type="radio" value="order" name="config[display]"<?php echo Utility::if_check($advert_cate['config']['display'] == 'order'); ?>>
                                        显示顺序中的第一个
                                    </label>
                                </div>
                            </div>
                        </div>
						<div class="form-group">
                            <label for="vieworder" class="col-md-2 control-label">
                                显示顺序
                            </label>
                            <div class="col-md-10">
                                <input type="number" class="form-control" id="vieworder" name="vieworder" value="<?php echo $advert_cate['vieworder']; ?>">
                            </div>
                        </div>
						<div class="form-group">
							<label class="col-md-2 control-label">
                                是否开启
                            </label>
							<div class="col-md-10 checkbox">
                                <label><input type="checkbox" name="status"<?php echo Utility::if_check($advert_cate['status']); ?>>开启</label>
								<span class="help-block">开启后，才会展示广告位里的广告</span>
                            </div>
                        </div>
						<div class="form-group">
							<div class="col-md-offset-2 col-md-10">
                                <div class="btn-wrap">
									<button type="submit" class="btn btn-primary J-ajax-submit-btn mr5">确认提交</button>
								</div>
                            </div>
                        </div>
					</form>
				</div>
			</div>
			<!--/.panel -->
			<div class="panel panel-default panel-my">
				<div class="panel-heading">广告位代码调用说明</div>
				<div class="panel-body">
					<ul>
						<li>新添加的广告位需要将调用代码添加到相应的模板中，才能使广告位生效</li>
						<li>
							调用方法：
							<ul>
								<li>使用辅助函数<code>get_advert($key)</code>获取需要显示的广告数据</li>
								<li>参数<code>$key</code>表示广告位的标识符（必填）</li>
								<li>结果返回一个数组，使用<code>list</code>方法把数组中的值赋值给两个变量<code>$advert_html</code>, <code>$advert_array</code></li>
								<li><code>$advert_html</code>为当前显示的广告内容，<code>$advert_array</code>为多广告内容数组</li>
							</ul>
						</li>
						<li>代码如下：</li>
					</ul>
					<pre>&lt;?php
    list($advert_html, $advert_array) = get_advert('site-header');
    if ($advert_html) echo $advert_html;
?&gt;</pre>
				</div>
			</div>
			<!--/.panel -->
		</div>
		<!--/.main-content -->
	</div>
	<!--/.row -->
</div>
<!--/.container-fluid -->
<?php $this->load->view('footer'); ?>
</body>
</html>